Send feedback on this topic.
Teradata.Client.Provider
GetFieldValueAsync<T>(Int32,CancellationToken) Method



Teradata.Client.Provider Namespace > TdDataReader Class > GetFieldValueAsync Method : GetFieldValueAsync<T>(Int32,CancellationToken) Method
The data type of the value to be returned.
Column ordinal (see TdDataReader.GetOrdinal).
A Threading.CancellationToken used to indicate that the asynchronous operation should be canceled.
Gets the value of the specified column asynchronously, if necessary.
Syntax
'Declaration
 
Public Overloads Overrides NotOverridable Function GetFieldValueAsync(Of T)( _
   ByVal ordinal As Integer, _
   ByVal cancellationToken As CancellationToken _
) As Task(Of T)
'Usage
 
Dim instance As TdDataReader
Dim ordinal As Integer
Dim cancellationToken As CancellationToken
Dim value As Task(Of T)
 
value = instance.GetFieldValueAsync(Of T)(ordinal, cancellationToken)
public override Task<T> GetFieldValueAsync<T>( 
   int ordinal,
   CancellationToken cancellationToken
)
public:
Task<T^>^ GetFieldValueAsyncgeneric<typename T>
( 
   int ordinal,
   CancellationToken cancellationToken
) override 

Parameters

ordinal
Column ordinal (see TdDataReader.GetOrdinal).
cancellationToken
A Threading.CancellationToken used to indicate that the asynchronous operation should be canceled.

Type Parameters

T
The data type of the value to be returned.

Return Value

Returns the value of the specified field represented as a T type.
Exceptions
ExceptionDescription
The TdDataReader is closed.
ordinal is less than zero or ordinal is equal to or greater than TdDataReader.FieldCount.
CommandBehavior is set to SchemaOnly, or there is no data for the row or column, or preceding columns are no longer accessible, or there is already an Asynchronous method in progress.
Remarks
Supported types:
               Int16    Int32    Int64       Decimal    Double    Single    Boolean
               Int16?   Int32?   Int64?      Decimal?   Double?   Single?   Boolean?
               Byte     Char     DateTime    TimeSpan   DateTimeOffset      Byte[] 
               Byte?    Char?    DateTime?   TimeSpan?  DateTimeOffset?     Char[]
               String   Stream   TextReader  XmlReader
               
               Plus all Teradata provider specific types
            

If you cancel this function when reading a LOB value you will not be able to successfully repeat the call to fetch that same value again.
The data reader will however remain in a valid state and you will be able to fetch the following columns in that row, or to fetch the following rows.

If this function generates a runtime exception that exception will be wrapped within a AggregateException within the returned Task:

Exception Description
InvalidCastException Type T is not supported for this column.
OperationCanceledException The asynchronous operation was canceled.
TdException The Teradata Database returned an error, or .NET Data Provider for Teradata detected an error.
Requirements

Target Platforms: Windows 7, Windows 8, Windows 8.1, Windows 10, Windows Server 2008, Windows Server 2008 R2, Windows Server 2012, Windows Server 2012 R2

See Also

Reference

TdDataReader Class
TdDataReader Members
Overload List